var main_url = "https://trade.sinvocloud.com/mobile/";

export function getToken() {
  if (
    localStorage.getItem("token") &&
    localStorage.getItem("nowTime") &&
    localStorage.getItem("state")
  ) {
    let now = new Date().getTime();
    let old = localStorage.getItem("nowTime");
    let jian = now - old;
    if (jian > 1000 * 60 * 60 * 60 * 24 * 30) {
      window.location.href = `${main_url}#/weixinAuth?market_id=${localStorage.getItem(
        "state"
      )}`;
    } else {
      window.location.href = `${main_url}#/vip`;
    }
  } else {
    if (localStorage.getItem("state")) {
      window.location.href = `${main_url}#/weixinAuth?market_id=${localStorage.getItem(
        "state"
      )}`;
    } else {
      window.location.href = `${main_url}#/weixinAuth`;
    }
  }
}
